/** Copyright 2011 SERLI

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License. **/

package com.serli.neeriou.client.android.controller;

import java.util.ArrayList;
import org.jivesoftware.smack.XMPPException;

import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.serli.neeriou.client.android.model.ApplicationProperties;
import com.serli.neeriou.client.android.model.ChatUser;
import com.serli.neeriou.client.android.model.exceptions.TechnicalException;

/**
 * The Interface ControllerInt.
 */
public interface ChatControllerInt {

	/**
	 * Gets the close users.
	 * 
	 * @return the close users
	 */
	public ArrayList<ChatUser> getCloseUsers();

	/**
	 * Connect.
	 *
	 * @param login the login
	 * @param password the password
	 * @param context the context
	 * @return true, if successful
	 * @throws XMPPException 
	 */
	public boolean connect(String login, String password, Context context) throws XMPPException;

	/**
	 * Disconnect.
	 *
	 * @return true, if successful
	 * @throws TechnicalException the technical exception
	 */
	public void disconnect();
	
	/**
	 * Send message.
	 *
	 * @param userName the user name
	 * @param msg the msg
	 * @return true, if successful
	 */
	public boolean sendMessage(final String userName, final String msg);
	
	/**
	 * Send msg list util.
	 *
	 * @return true, if successful
	 */
	public void sendMsgListUtil();
	
	/**
	 * Send msg cack.
	 *
	 * @return true, if successful
	 */
	public void sendMsgCACK();
	
	/**
	 * Send msg stat.
	 *
	 * @param status the status
	 * @return true, if successful
	 */
	public void sendMsgStat(int status);
	
	/**
	 * Send add starred.
	 *
	 * @param toUser the to user
	 * @return true, if successful
	 */
	public void sendAddStarred(String toUser);
	
	/**
	 * Send del starred.
	 *
	 * @param toUser the to user
	 * @return true, if successful
	 */
	public void sendDelStarred(String toUser);
	
	/**
	 * Send add blocked.
	 *
	 * @param toUser the to user
	 * @return true, if successful
	 */
	public void sendAddBlocked(String toUser);
	
	/**
	 * Send del blocked.
	 *
	 * @param toUser the to user
	 * @return true, if successful
	 */
	public void sendDelBlocked(String toUser);
	
	/**
	 * Send msg majgps.
	 *
	 * @param longitude the longitude
	 * @param latitude the latitude
	 * @return true, if successful
	 */
	public void sendMsgMAJGPS(double longitude, double latitude);
	
	/**
	 * Start monitoring.
	 *
	 * @param context the context
	 * @return true, if successful
	 */
	public void startMonitoring(Context context);
	
	/**
	 * Stop monitoring.
	 *
	 * @return true, if successful
	 */
	public void stopMonitoring();
	
	/**
	 * Checks if is connected to server.
	 *
	 * @param context the context
	 * @return true, if is connected to server
	 */
	public boolean isConnectedToServer(Context context);
	
	/**
	 * Gets the application properties.
	 *
	 * @param context the context
	 * @return the application properties
	 */
	public ApplicationProperties getApplicationProperties(Context context);
	
	/**
	 * Adds the chat.
	 *
	 * @param myUser the my user
	 */
	public void addChat(String login);
	
	/**
	 * Show chat list.
	 *
	 * @param context the context
	 * @param lvListe the lv liste
	 */
	public void showChatList(Context context, ListView lvListe);
	
	/**
	 * Sets the user.
	 *
	 * @param login the login
	 * @param status the status
	 * @param distance the distance
	 * @param isStarred the is starred
	 * @param isBlocked the is blocked
	 * @return the chat user
	 */
	public ChatUser setUser(String login, String status, double distance, boolean isStarred, boolean isBlocked);
	
	/**
	 * Delete chat.
	 *
	 * @param myUser the my user
	 */
	public void deleteChat(String login);
	
	public ArrayList<String> getDiscussionThread(String userName);
	
	public ArrayAdapter<String> getDiscussionThreadAdapter(String userName, Context context, int layout);

	public void sendMsgConn(String serverName, String keyLogin, String keyPassword);
}
